<template>
	<view style="min-height: 420rpx;">
		<!-- 审批记录 -->
		<view class="pl-30 pt-30">
			<sub-title>审批记录</sub-title>
		</view>
		<view v-if="flowList.length">
			<view class="pt-30 pb-20 pl-30 pr-30 approval-box fs-28" v-for="(item,index) in flowList">
				<u--image src="https://pc.chinaonebuild.com/images/user/userIcon.png" width="80rpx" height="80rpx" />
				<view class="ml-20 approval-info">
					<view class="mb-10 fs-28">
						{{item.taskName?item.taskName:''}}
						<text style="color: #239123;" v-if="item.comment">
							<text v-if="index==0">（已提交）</text>
							<text v-else>（{{item.comment.type=='1'?'已审批':item.comment.type=='3'?'已驳回':'已退回'}}）</text>
						</text>
						<text style="color: #239123;" v-else>（审批中）</text>
					</view>
					<view class="mb-10 line-user fs-20">
						<text>{{item.assigneeName?item.assigneeName:''}}</text>
						<text style="position: absolute;right: 0;">{{index==0?(item.createTime?item.createTime:''):(item.finishTime?item.finishTime:'')}}</text>
					</view>
					<view class="mb-10 mt-10 fs-28">
						<text v-if="index==0">发起申请</text>
						<view v-else-if="item.comment" style="overflow-wrap: break-word;">
							{{item.comment.comment?item.comment.comment:''}}
						</view>
						<view class="line-user fs-20" v-else>
							{{item.candidate?item.candidate:''}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<NoData v-else width="256rpx" height="256rpx" :msg="ifNoData?'暂无审批记录':'数据加载中...'" />
	</view>
</template>

<script>
	import SubTitle from '@/pagesIndex/component/SubTitle.vue'
	import NoData from "@/components/noData/index.vue"
	export default {
		props: {
			flowList: {
				type: Array,
				default: () => {
					return []
				}
			}
		},
		components: {
			SubTitle,
			NoData
		},
		watch: {
			flowList: {
				handler(val){
					if(val.length==0){
						this.ifNoData = true
					}
				},
			}
		},
		data() {
			return {
				ifNoData: false,
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.approval-box {
		display: flex;
		align-items: center;
		border-bottom: 1px solid #dee2eb;

		.approval-info {
			width: 600rpx;
		}

		.line-user {
			color: #B1B3B7;
			position: relative;
		}
	}

	.fs-28 {
		@include text-font-size(28rpx)
	}

	.fs-20 {
		@include text-font-size(20rpx)
	}
</style>
